#

import asyncio
from threading import Thread
from crond import Crond

c = Crond()


def proxy_server():
    try:
        asyncio.run(c.run())
    except Exception:
        print('auto restarted Proxy Server')
        proxy_server()


def api_server():
    try:
        c.cron_api()
    except Exception:
        print('auto restart Api Server')
        api_server()


def main():
    t = Thread(target=proxy_server)
    t.start()
    api_server()


if __name__ == "__main__":
    main()
